<template>
  <div :style="{ height: tableY + 75 + 'px'}" style="margin-bottom: 40px;">
    <div class="margin-bottom-xs">
      <a-button
          type="danger"
          icon="delete"
          @click="handleSub($refs.table.selectedRowKeys)"
      >
        {{$ct("delete","删除")}}
      </a-button>
      <a-button class="cu-btn-danger" type="link" @click="() => $emit('clearAll')">一键清空</a-button>
    </div>
    <!--	table	 -->
    <DataGrid
        ref="table"
        :columns="columns"
        :url="url"
        :queryParam="queryParam"
        rowKey="uuid"
        :format-conditions="true"
        :pageSize="20"
        :scroll="{
              y:tableY
          }"
    >
         <span slot="renderUserNameId" slot-scope="{ text, record, index }">
            {{ record.userName }}/{{  record.userNameId }}
        </span>
      <template slot="renderOperationResponeArgs" slot-scope="{ text, record }">
        <a class="table-link" style="cursor: pointer;color: red" @click="() => $emit('handleEdit',record,'errorLog') ">{{record.operationContent}}</a>
      </template>
    </DataGrid>
  </div>
</template>


<!--script-->
<script>
//数据表格组件
import {DataGrid} from "@/components";
//方法封装
import {dataGridMixin} from "@/mixins/dataGridMixin";
//新增编辑界面
import editForm from './edit.vue'
//字典
import TDictSelectTag from '@/components/TopVUI/dict/TDictSelectTag'
import TMultiSelectTag from '@/components/TopVUI/dict/TMultiSelectTag'
import ARow from "ant-design-vue/es/grid/Row";

export default {
  name: "Table",
  components: {ARow, DataGrid, editForm, TDictSelectTag, TMultiSelectTag},
  mixins: [dataGridMixin],
  filters: {},
  props: {
    tableY: 0,
    queryParam: {
      type: Object,
      defaultValue: () => {
        return {
          operationType: 'requestLog.02',
        }
      }
    },// 查询参数
  },
  data() {
    return {
      columns: [
        {
          title: '请求时间',
          width: 200,
          dataIndex: 'createTime',
          langCode: "requestTime"
        },
        {
          title: '请求账号',
          width: 160,
          dataIndex: 'userNameId',
          scopedSlots: {
            customRender: 'renderUserNameId'
          }
        },
        {
          title: '异常IP',
          width: 160,
          dataIndex: 'operationIp',
          langCode: "requestIP"
        },
        {
          title: '异常模块',
          width: 200,
          dataIndex: 'operationModular',
        },
        {
          title: '请求描述',
          width: 200,
          dataIndex: 'operationDesc',
        },

        {
          title: '异常记录',
          dataIndex: 'operationContent',
          scopedSlots: {
            customRender: 'renderOperationResponeArgs'
          }
        },
      ],
      visible: false,
      confirmLoading: false,
      mdl: null,
      url: {
        getPageSet: 'system/sysOperationLog/getPageSet',
        save: '/system/sysOperationLogin/save',
        update: '/system/sysOperationLogin/update',
        deleteBatch: '/system/sysOperationLog/deleteBatch'
      },
      startTime: ''
    };
  },
  methods: {
  },
};
</script>

<!--style-->
<style scoped lang="less">
.table {
  background-color: @base-bg-color;
  padding: 24px;
}

.table-link:hover{
  text-decoration: underline;
}
</style>
